package com.e3.basdoc.tax.client;

import java.util.List;

import com.e3.basdoc.tax.model.TaxModel;
import com.e3.template.tgf.MyGFUI;
import com.e3.template.tgf.TGFEditorDialog;
import com.e3.template.tgf.TGFGridPanel;
import com.e3.template.tgf.TGFQueryDialog;
import com.e3.template.tgf.TGFSimpleFormPanel;
import com.e3.template.tgf.TGFStateMachine;
import com.e3.web.core.client.GXTHelper;
import com.e3.web.widget.client.BaseAction;
import com.google.gwt.user.client.rpc.AsyncCallback;

public class TaxUI extends MyGFUI<TaxModel> {
	
	private TaxRPCServiceAsync service = TaxRPCService.Util.getInstance();

	@Override
	protected TGFSimpleFormPanel<TaxModel> createFormPanel() {
		return new TaxFormPanel();
	}

	@Override
	protected TGFGridPanel<TaxModel> createGridPanel() {
		return new TaxGridPanel();
	}

	@Override
	protected TGFQueryDialog<TaxModel> createQueryDialog() {
		return new TaxQueryDialog();
	}

	@Override
	protected TGFEditorDialog<TaxModel> createEditorDialog() {
		return new TaxEditorDialog();
	}

	@Override
	protected void executeDeleteService(final List<TaxModel> models,AsyncCallback<Void> callback) {
		service.deleteTaxs(models,callback);
	}

	@Override
	protected String getCurrentLocalName() {
		return TaxMessages.INSTANCE.local_name();
	}

	@Override
	protected TaxModel createModelInstance() {
		return new TaxModel();
	}

	@Override
	protected BaseAction[] getToolButtonActions() {
		if(GXTHelper.isSuperAdmin()){
			return super.getToolButtonActions();
		}
		return new BaseAction[]{TGFStateMachine.QUERY_ACTION,TGFStateMachine.NEW_ACTION,TGFStateMachine.MODIFY_ACTION};
	}

}
